<style>
.closepay {
    width: 1.5rem;
    height: 1.5rem;
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    border-radius: 1.5rem;
    text-align: center;
    line-height: 1.5rem;
    font-size: 1.3rem;
    color:{{main.syscolor||'#ff5555'}};
    z-index: 18;
}
.c {text-align:center}
.bold {font-weight:bold}
.fui-cell {border:1px solid #f2f2f2;margin-bottom:10px}
.fui-cell.active{border:1px solid #18bc9c;}
</style>
<div id="newcore-pay-modal" class="modal fade" tabindex="-1" style="z-index:99999;display:none">
<div class="modal-dialog" style="width:70%;left:0%;bottom:0;">
<div class='modal-content' style="padding-bottom:0.6rem;border-bottom-left-radius:0;border-bottom-right-radius:0;">
		<div aria-hidden="true" data-dismiss="modal" class="closepay"><i class="icon jinyunicon icon-wrong" style="font-size: 1.3rem;"></i></div>
		<div class='fui-cell-title bold c' style="padding-top:1.3rem;padding-bottom:0;font-size:1rem">Payment order</div>
		<div class='fui-cell-title bold c'><span>$</span><span class="bigprice core-pay-fee" style="font-size:1.6rem">{{paydata.fee}}</span></div>
		<div class="fui-cell-title" style="margin-top:-0.3rem">
			<div class="c subtitle">The order no：<span class="core-pay-ordersn">{{paydata.tid}}</span></div>
		</div>
		<div class="fui-cell-group" style="padding:0 30px">
			<div class="fui-cell-title bold" style="font-size:22px">Payment method</div>
			<div class="fui-cell-title gray" style="padding-top:0">All transactions are secure and encrypted</div>
			<div ng-repeat="item in paydata.pay_types" class="fui-cell {{paydata.type==item.name?'active':''}}" ng-click="paydata.type=item.name">
				<div class="fui-cell-lable">
					<input type="radio" ng-checked="paydata.type==item.name" ng-model="paydata.type" class="fui fui-radio fui-radio-danger verify-radio" value="{{item.name}}">
				</div>
                <div class="fui-cell-info">
					 {{item.title}}
				</div>
				<div ng-if="item.images.length>0" class="fui-cell-remark noremark">
					<img ng-repeat="img in item.images" ng-src="{{tomedia(img)||''}}"/>
				</div>
				<div ng-if="(!item.images || item.images.length==0) && item.name!='hdfk' && item.name!='credit'" class="fui-cell-remark noremark">
					<img src="../core/resource/images/visa.svg"/>
					<img src="../core/resource/images/mastercard.svg"/>
					<img src="../core/resource/images/amex.svg"/>
					<img src="../core/resource/images/giropay.svg"/>
				</div>
            </div>
		</div>
		<div class="modal-footer" style="margin-top:10px;">
			<a class="core-pay btn btn-success block" style="margin:0.5rem 1rem;border-radius:1rem" href="javascript:;" ng-click="new_gotopay();">Confirm the payment</a>
		</div>
</div>
</div>
</div>
<script>
scope.new_gotopay=function(){
	if(!scope.paydata.type){
		scope.message('Please select a payment method！');
		return false;
	}
	var pay_type=scope.paydata.type;
	scope.tool.pay(scope.paydata.id,function(res){
			console.log('new_gotopay');console.log(res);
			var complete_url= scope.paydata.complete_url?scope.paydata.complete_url:'';
			var fail_url= scope.paydata.fail_url?scope.paydata.fail_url:complete_url;
			console.log('new_gotopay');console.log(complete_url);
			if(res.type=='success'){
					scope.message('Pay for success！','success',complete_url);
			}else{
					scope.message('Pay for failure！','success',fail_url);
			}
	},pay_type,'','','','',{'pay_en':'en'});
	$('#newcore-pay-modal').modal('hide');
}
</script>